import Index from '../layout/Index.vue'
import Dashboard from '../views/Dashboard'

export const asyncRouter = {
  path: '/',
  name: 'Index',
  redirect: '/dashboard',
  component: Index,
  children: [
    // 后台首页
    {
      path: '/dashboard',
      meta: { name: '后台首页', icon: 'icon-shouye' },
      component: Dashboard
    },
    // 订单管理
    {
      path: '/orders',
      meta: { name: '订单管理', role: ['super', 'normal'], icon: 'icon-icon-' },
      redirect: '/orders/list',
      component: () =>
        import(/* webpackChunkName: "orders" */ '../views/Orders'),
      children: [
        {
          path: '/orders/list',
          meta: { name: '订单列表' },
          component: () =>
            import(/* webpackChunkName: "orders" */ '../views/Orders/List')
        },
        {
          name: 'orderEdit',
          path: '/orders/edit/:id',
          meta: { name: '订单编辑', role: ['super'] },
          hidden: true,
          component: () =>
            import(/* webpackChunkName: "orders" */ '../views/Orders/Edit')
        }
      ]
    },
    // 商品管理
    {
      path: '/goods',
      meta: { name: '商品管理', icon: 'icon-shangpin' },
      component: () => import(/* webpackChunkName: "goods" */ '../views/Goods'),
      children: [
        {
          path: '/goods/list',
          meta: { name: '商品列表' },
          component: () =>
            import(/* webpackChunkName: "goods" */ '../views/Goods/List.vue')
        },
        {
          path: '/goods/add',
          meta: { name: '商品添加' },
          component: () =>
            import(/* webpackChunkName: "goods" */ '../views/Goods/Add.vue')
        },
        {
          path: '/goods/cate',
          meta: { name: '商品分类' },
          component: () =>
            import(/* webpackChunkName: "goods" */ '../views/Goods/Cate.vue')
        }
      ]
    },
    // 店铺管理
    {
      path: '/store',
      meta: { name: '店铺管理', role: ['super'], icon: 'icon-dianpu' },
      component: () => import(/* webpackChunkName: "store" */ '../views/Store')
    },
    // 账号管理
    {
      path: '/account',
      meta: {
        name: '账号管理',
        role: ['super', 'normal'],
        icon: 'icon-zhanghao'
      },
      component: () =>
        import(/* webpackChunkName: "account" */ '../views/Account'),
      children: [
        {
          path: '/account/list',
          meta: { name: '账号列表', role: ['super'] },
          component: () =>
            import(
              /* webpackChunkName: "account" */ '../views/Account/List.vue'
            )
        },
        {
          path: '/account/add',
          meta: { name: '账号添加', role: ['super'] },
          component: () =>
            import(/* webpackChunkName: "account" */ '../views/Account/Add.vue')
        },
        {
          path: '/account/reset',
          meta: { name: '修改密码' },
          component: () =>
            import(
              /* webpackChunkName: "account" */ '../views/Account/ResetPwd.vue'
            )
        },
        {
          path: '/account/mine',
          meta: { name: '个人中心' },
          hidden: true,
          component: () =>
            import(
              /* webpackChunkName: "account" */ '../views/Account/Mine.vue'
            )
        }
      ]
    },
    // 销售统计
    {
      path: '/count',
      meta: { name: '销售统计', role: ['super'], icon: 'icon-tongji' },
      component: () => import(/* webpackChunkName: "count" */ '../views/Count'),
      children: [
        {
          path: '/count/goods',
          meta: { name: '商品统计' },
          component: () =>
            import(/* webpackChunkName: "count" */ '../views/Count/Goods.vue')
        },
        {
          path: '/count/orders',
          meta: { name: '订单统计' },
          component: () =>
            import(/* webpackChunkName: "count" */ '../views/Count/Orders.vue')
        }
      ]
    }
  ]
}
